﻿using PivotCollectionTools.Xml;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.ObjectModel;
using System;
using System.IO;

namespace PivotCollectionTools.Xml.Test
{
    
    
    /// <summary>
    ///This is a test class for PivotXmlTest and is intended
    ///to contain all PivotXmlTest Unit Tests
    ///</summary>
    [TestClass()]
    public class PivotXmlTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for SchemaVersion
        ///</summary>
        [TestMethod()]
        public void PivotXml_SchemaVersion_Test()
        {
            PivotXml target = new PivotXml();
            decimal expected = 0.0m;
            decimal actual;
            target.SchemaVersion = expected;
            actual = target.SchemaVersion;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Name
        ///</summary>
        [TestMethod()]
        public void PivotXml_Name_Test()
        {
            PivotXml target = new PivotXml();
            string expected = "testName";
            string actual;
            target.Name = expected;
            actual = target.Name;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for ItemList
        ///</summary>
        [TestMethod()]
        public void PivotXml_ItemList_Test()
        {
            PivotXml target = new PivotXml();
            Assert.AreEqual(target.ItemList.Count, 0);
            target.AddItemList("test");
            Assert.AreEqual(target.ItemList.Count, 1);
        }

        /// <summary>
        ///A test for FacetCategories
        ///</summary>
        [TestMethod()]
        public void PivotXml_FacetCategories_Test()
        {
            PivotXml target = new PivotXml();
            Assert.AreEqual(target.FacetCategories.Count, 0);
            target.FacetCategories.Add(new FacetCategory());
            Assert.AreEqual(target.FacetCategories.Count, 1);
        }

        /// <summary>
        ///A test for WriteXml
        ///</summary>
        [TestMethod()]
        public void PivotXml_WriteXmlTest()
        {
            PivotXml target = new PivotXml();
            string fileName = "WriteTest.xml";
            target.WriteXml(fileName);
            Assert.IsTrue(File.Exists(fileName));
        }

        /// <summary>
        ///A test for CreateFromXml
        ///</summary>
        [TestMethod()]
        public void CreateFromXmlTest()
        {
            string fileName = "../../../kiva.xml"; // TODO: Initialize to an appropriate value
            PivotXml expected = null; // TODO: Initialize to an appropriate value
            PivotXml actual;
            actual = PivotXml.CreateFromXml(fileName);
            actual.WriteXml("../../../kiva2.xml");
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for AddItemList
        ///</summary>
        [TestMethod()]
        public void PivotXml_Add_ItemList_Test()
        {
            PivotXml target = new PivotXml(); // TODO: Initialize to an appropriate value
            string imageBase = @"asdf\asdf.sd"; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.AddItemList(imageBase);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(target.ItemList[0].ImageBase, imageBase);
        }

        /// <summary>
        ///A test for AddCategory
        ///</summary>
        [TestMethod()]
        public void PivotXml_Add_Category_Test()
        {
            PivotXml target = new PivotXml(); // TODO: Initialize to an appropriate value
            FacetCategory category = new FacetCategory("test", FacetDataType.String, true, true, true);
            target.AddCategory(category);
            Assert.AreEqual(target.FacetCategories[0].Name, "test");
        }

        /// <summary>
        ///A test for PivotXml Constructor
        ///</summary>
        [TestMethod()]
        public void PivotXml_PivotXml_Constructor_Test()
        {
            PivotXml target = new PivotXml();
            Assert.IsNotNull(target);
        }
    }
}
